/*
 * @Author: duchengdong
 * @Date: 2021-10-12 14:21:16
 * @LastEditors: duchengdong
 * @LastEditTime: 2021-12-28 21:22:54
 * @Description:
 */
import { useState, useEffect, Suspense } from 'react'
import { BrowserRouter as Router } from 'react-router-dom'
import LoadingHtmp from 'layout/LoadingHtmp'
import RouteConfig, { initRouteConfig} from './routes/router.config'
import RouteView, { IRouteViewProps } from './routes/RouteView'

function App() {
    const [routeArr, setRouteArr] = useState<IRouteViewProps[]>(initRouteConfig)    
    useEffect(() => {
        setRouteArr(RouteConfig)
    }, [])

    return (
        <Router>
            <Suspense fallback={<LoadingHtmp />}>
                <RouteView children={routeArr} />
            </Suspense>
        </Router>
    )
}

export default App
